Graphene strongly ties to Arquillian Core and its extensions Containers and Drone to manage lifecycle of the application server, selenium server and Graphene.
In the common scenarios, you need only to choose container you would like to deploy application into and the framework you would like to use for testing.
Test Frameworks Options
In case of Java testing frameworks, you can choose between
and use appropriate dependency chain in your Maven POM as you can see bellow
Arquillian Mode Options
You can choose between following Arquillian modes:
and use appropriate dependency chain in your Maven as you can see bellow.
JUnit Standalone
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!-- Arquillian JUnit Standalone -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-standalone</artifactId>
<version>1.0.0.Final</version>
<scope>test</scope>
</dependency>
<!-- Graphene dependency chain - imports all other dependencies required -->
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>arquillian-graphene</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>test</scope>
</dependency>
JUnit Container
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!-- Arquillian JUnit Container -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.0.0.Final</version>
<scope>test</scope>
</dependency>
<!-- Graphene dependency chain - imports all other dependencies required -->
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>arquillian-graphene</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>test</scope>
</dependency>
TestNG Standalone
<!-- TestNG -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.14.6</version>
<scope>test</scope>
</dependency>
<!-- Arquillian TestNG Standalone -->
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng-standalone</artifactId>
<version>1.0.0.Final</version>
<scope>test</scope>
</dependency>
<!-- Graphene dependency chain - imports all other dependencies required -->
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>arquillian-graphene</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>test</scope>
</dependency>
TestNG Container
<!-- TestNG -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.14.6</version>
<scope>test</scope>
</dependency>
<!-- Arquillian TestNG Container -->
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng-container</artifactId>
<version>1.0.0.Final</version>
<scope>test</scope>
</dependency>
<!-- Graphene dependency chain - imports all other dependencies required -->
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>arquillian-graphene</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>test</scope>
</dependency>
These dependencies will make available all of the following dependencies:
All of the dependencies manages their required versions.
Although you can manage them and override versions in your project, however there are no guarantee all of the features will work as expected when doing so.
Starting with testing from Java
The sample Graphene test can look like this one:
@RunWith(Arquillian.class)
public class BasicTestCase {
URL url = URLUtils.buildUrl("http://www.google.com/");
@Drone
GrapheneSelenium browser;
@Test
public void testOpeningHomePage() {
browser.open(url);
}
}
Other Samples of Usage
For complete sample of usage, you can inspect functional test of Graphene:
Application Container Options
Arquillian has been chosen as suitable container for running Selenium tests since it provides support of managing application servers and deployments.
Refer Arquillian Documentation for complete reference of Arquillian Core and specifically Container adapters.
You will need to define container dependencies and setup arquillian.xml.
Using Drone
Drone is extension for Arquillian that manages lifecycle of the Selenium Server and Selenium clients as Selenium 1.x, Selenium 2.x and Graphene.
For using Drone, refer to Drone Extension Documentation.